<!--
 * @Author: ljc
 * @Date: 2024-07-16 14:57:54
 * @LastEditors: g05047
 * @LastEditTime: 2024-07-17 15:49:53
 * @Description: 项目发行面板
-->
<template>
  <div class="issuance-contain">
    <div style="padding: 10px;">
      <el-form :model="formValue"
        ref="formRef">
        <el-row>
          <el-col :span="8">
            <el-form-item label="是否发行">
              <el-input v-model="formValue.issuanceStatus"
                :disabled="true">
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div style="flex: auto;">
      <rk-grid ref="rkGridRef"
        title="发行情况"
        :emptyText="emptyText"
        :autoLoad="false"
        dataUrl="/bondPro/34/info"
        :boxConfig="false"
        :seqConfig="true"
        :params="queryParams"
        :columns="tableColumns"
        :totaled="true"
        :pagerConfig="false"
        @loaded="handleLoaded">
      </rk-grid>
    </div>
  </div>
</template>
  
  <script setup name="IssuanceStatusPanel">
const formRef = ref(null)
// 查询参数
const queryParams = reactive({
  proId: undefined,
})
const emptyText = ref(' ')
const formValue = reactive({
  issuanceStatus: '否'
})
const props = defineProps({
  // 组件的名称，用于组织插槽数据，提供给表单设计器以及渲染器（必须定义）
  title: { type: String, default: '项目发行面板' },
  // 表单数据信息
  formData: {
    type: Object,
    default: () => {
      return {
        proId: '',
      };
    },
  },
  formType: { type: String },
});
// 表格的模板引用
const rkGridRef = ref();
// ----- 表格相关操作
const tableColumns = ref([
  { field: 'issueYear', title: '年度', width: 120, align: 'center', },
  {
    field: 'totalApplyAmt',
    title: '金额（万元）',
    width: 500,
    formatter: 'formatThousand',
    align: 'right',
    totaled: true,
  },
])
/**查询 */
const handleSearch = () => {
  rkGridRef.value.searchEvent()
}
/**获取表格数据 */
const handleLoaded = (finalData) => {
  formValue.issuanceStatus = finalData.length > 0 ? '是' : '否'
};
onMounted(() => {
  const { proId } = props.formData
  queryParams.proId = proId
  handleSearch()
});
  </script>
  <style lang="scss" scoped>
.issuance-contain {
	display: flex;
	flex-direction: column;
	height: 100%;
}
</style>
  